import request from "@/utils/request";

export const Login = (data) => {
  return request({
    url: "login",
    method: "post",
    data,
  });
};

// 获取管理员信息和权限菜单
export const getinfo = (data) => {
  return request({
    url: "/getinfo",
    method: "post",
    data,
  });
};
// 退出登录 POST

export const logout = (data) => {
  return request({
    url: "/logout",
    method: "post",
    data,
  });
};

// 修改密码
export const updatepassword = (data) => {
  return request({
    url: "/updatepassword",
    method: "post",
    data,
  });
};

// 用户列表
export const getUserList = ({ page, limit, keyword }) => {
  return request({
    url: `/user/${page}?limit=${limit}&keyword=${keyword}`,
    method: "get",
  });
};

// 修改状态
export const changStatus = (id, data) => {
  return request({
    url: `/user/${id}/update_status`,
    method: "POST",
    data,
  });
};

// 添加内容

export const addUser = (data) => {
  return request({
    url: `/user`,
    method: "POST",
    data,
  });
};
// 修改内容
export const editUser = (id, data) => {
  return request({
    url: `/user/${id}`,
    method: "POST",
    data,
  });
};
// 删除
export const delUser = (id) => {
  return request({
    url: `/user/${id}/delete `,
    method: "POST",
  });
};

